<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>ttk::notebook manual page - Tk Themed Widget</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk Commands</a> <small>&gt;</small> ttk_notebook</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="ttk_notebook.htm#M2" NAME="L1953">NAME</A>
<DL><DD>ttk::notebook &mdash; Multi-paned container widget</DD></DL>
<DD><A HREF="ttk_notebook.htm#M3" NAME="L1954">SYNOPSIS</A>
<DL>
</DL>
<DD><A HREF="ttk_notebook.htm#M4" NAME="L1955">DESCRIPTION</A>
<DD><A HREF="ttk_notebook.htm#M5" NAME="L1956">STANDARD OPTIONS</A>
<DL>
<DD><A HREF="ttk_widget.htm#M-class">-class, undefined, undefined</A>
<DD><A HREF="ttk_widget.htm#M-cursor">-cursor, cursor, Cursor</A>
<DD><A HREF="ttk_widget.htm#M-style">-style, style, Style</A>
<DD><A HREF="ttk_widget.htm#M-takefocus">-takefocus, takeFocus, TakeFocus</A>
</DL>
<DD><A HREF="ttk_notebook.htm#M6" NAME="L1957">WIDGET-SPECIFIC OPTIONS</A>
<DL>
<DD><A HREF="ttk_notebook.htm#M7" NAME="L1958">-height, height, Height</A>
<DD><A HREF="ttk_notebook.htm#M8" NAME="L1959">-padding, padding, Padding</A>
<DD><A HREF="ttk_notebook.htm#M9" NAME="L1960">-width, width, Width</A>
</DL>
<DD><A HREF="ttk_notebook.htm#M10" NAME="L1961">TAB OPTIONS</A>
<DL>
<DD><A HREF="ttk_notebook.htm#M11" NAME="L1962">-state, state, State</A>
<DD><A HREF="ttk_notebook.htm#M12" NAME="L1963">-sticky, sticky, Sticky</A>
<DD><A HREF="ttk_notebook.htm#M13" NAME="L1964">-padding, padding, Padding</A>
<DD><A HREF="ttk_notebook.htm#M14" NAME="L1965">-text, text, Text</A>
<DD><A HREF="ttk_notebook.htm#M15" NAME="L1966">-image, image, Image</A>
<DD><A HREF="ttk_notebook.htm#M16" NAME="L1967">-compound, compound, Compound</A>
<DD><A HREF="ttk_notebook.htm#M17" NAME="L1968">-underline, underline, Underline</A>
</DL>
<DD><A HREF="ttk_notebook.htm#M18" NAME="L1969">TAB IDENTIFIERS</A>
<UL class="tab identifiers">
</UL>
<DD><A HREF="ttk_notebook.htm#M19" NAME="L1970">WIDGET COMMAND</A>
<DL class="widget command">
<DD><A HREF="ttk_notebook.htm#M20" NAME="L1971"><I>pathname </I><B>add </B><I>window</I> ?<I>options...</I>?</A>
<DD><A HREF="ttk_notebook.htm#M21" NAME="L1972"><I>pathname </I><B>configure</B> ?<I>options</I>?</A>
<DD><A HREF="ttk_notebook.htm#M22" NAME="L1973"><I>pathname </I><B>cget </B><I>option</I></A>
<DD><A HREF="ttk_notebook.htm#M23" NAME="L1974"><I>pathname </I><B>forget </B><I>tabid</I></A>
<DD><A HREF="ttk_notebook.htm#M24" NAME="L1975"><I>pathname </I><B>hide </B><I>tabid</I></A>
<DD><A HREF="ttk_notebook.htm#M25" NAME="L1976"><I>pathname </I><B>identify</B><I> component x y</I></A>
<DL class="widget command">
<DD><A HREF="ttk_notebook.htm#M26" NAME="L1977"><I>pathname </I><B>identify element</B> <I>x y</I></A>
<DD><A HREF="ttk_notebook.htm#M27" NAME="L1978"><I>pathname </I><B>identify tab</B> <I>x y</I></A>
</DL>
<DD><A HREF="ttk_notebook.htm#M28" NAME="L1979"><I>pathname </I><B>index </B><I>tabid</I></A>
<DD><A HREF="ttk_notebook.htm#M29" NAME="L1980"><I>pathname </I><B>insert </B><I>pos subwindow options...</I></A>
<DD><A HREF="ttk_notebook.htm#M30" NAME="L1981"><I>pathname </I><B>instate </B><I>statespec </I>?<I>script...</I>?</A>
<DD><A HREF="ttk_notebook.htm#M31" NAME="L1982"><I>pathname </I><B>select</B> ?<I>tabid</I>?</A>
<DD><A HREF="ttk_notebook.htm#M32" NAME="L1983"><I>pathname </I><B>state</B> ?<I>statespec</I>?</A>
<DD><A HREF="ttk_notebook.htm#M33" NAME="L1984"><I>pathname </I><B>tab </B><I>tabid</I> ?<I>-option </I>?<I>value ...</I></A>
<DD><A HREF="ttk_notebook.htm#M34" NAME="L1985"><I>pathname </I><B>tabs</B></A>
</DL>
<DD><A HREF="ttk_notebook.htm#M35" NAME="L1986">KEYBOARD TRAVERSAL</A>
<UL class="keyboard traversal">
</UL>
<DD><A HREF="ttk_notebook.htm#M36" NAME="L1987">VIRTUAL EVENTS</A>
<DD><A HREF="ttk_notebook.htm#M37" NAME="L1988">EXAMPLE</A>
<DD><A HREF="ttk_notebook.htm#M38" NAME="L1989">STYLING OPTIONS</A>
<DD><A HREF="ttk_notebook.htm#M39" NAME="L1990">SEE ALSO</A>
<DD><A HREF="ttk_notebook.htm#M40" NAME="L1991">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
ttk::notebook &mdash; Multi-paned container widget
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>ttk::notebook</B> <I>pathname </I>?<I>options...</I>?<BR>
<I>pathname </I><B>add</B> <I>window</I> ?<I>options...</I>?<BR>
<I>pathname </I><B>insert</B> <I>index</I> <I>window</I> ?<I>options...</I>?<BR>
<H3><A NAME="M4">DESCRIPTION</A></H3>
A <B>ttk::notebook</B> widget manages a collection of windows
and displays a single one at a time.
Each content window is associated with a <I>tab</I>,
which the user may select to change the currently-displayed window.
<H3><A NAME="M5">STANDARD OPTIONS</A></H3>
<DL>
<DT><B><A HREF="ttk_widget.htm#M-class">-class, undefined, undefined</A></B>
<DT><B><A HREF="ttk_widget.htm#M-cursor">-cursor, cursor, Cursor</A></B>
<DT><B><A HREF="ttk_widget.htm#M-style">-style, style, Style</A></B>
<DT><B><A HREF="ttk_widget.htm#M-takefocus">-takefocus, takeFocus, TakeFocus</A></B>
</DL>
<H3><A NAME="M6">WIDGET-SPECIFIC OPTIONS</A></H3>
<DL>
<DT>Command-Line Name: <B><A NAME="M7">-height</A></B>
<DT>Database Name: <B>height</B>
<DT>Database Class: <B>Height</B>
<DD>If present and greater than zero,
specifies the desired height of the pane area
(not including internal padding or tabs).
Otherwise, the maximum height of all panes is used.
<P><DT>Command-Line Name: <B><A NAME="M8">-padding</A></B>
<DT>Database Name: <B>padding</B>
<DT>Database Class: <B>Padding</B>
<DD>Specifies the amount of extra space to add around the outside
of the notebook.
The padding is a list of up to four length specifications
<I>left top right bottom</I>.
If fewer than four elements are specified,
<I>bottom</I> defaults to <I>top</I>,
<I>right</I> defaults to <I>left</I>, and
<I>top</I> defaults to <I>left</I>.
In other words, a list of three numbers specify the left, vertical, and right padding;
a list of two numbers specify the horizontal and the vertical padding;
a single number specifies the same padding all the way around the widget.
<P><DT>Command-Line Name: <B><A NAME="M9">-width</A></B>
<DT>Database Name: <B>width</B>
<DT>Database Class: <B>Width</B>
<DD>If present and greater than zero,
specifies the desired width of the pane area
(not including internal padding).
Otherwise, the maximum width of all panes is used.
</DL>
<H3><A NAME="M10">TAB OPTIONS</A></H3>
The following options may be specified for individual notebook panes:
<DL>
<DT>Command-Line Name: <B><A NAME="M11">-state</A></B>
<DT>Database Name: <B>state</B>
<DT>Database Class: <B>State</B>
<DD>Either <B>normal</B>, <B>disabled</B> or <B>hidden</B>.
If <B>disabled</B>, then the tab is not selectable.
If <B>hidden</B>, then the tab is not shown.
<P><DT>Command-Line Name: <B><A NAME="M12">-sticky</A></B>
<DT>Database Name: <B>sticky</B>
<DT>Database Class: <B>Sticky</B>
<DD>Specifies how the content window is positioned within the pane area.
Value is a string containing zero or more of the characters
<B>n, s, e,</B> or <B>w</B>.
Each letter refers to a side (north, south, east, or west)
that the content window will
&ldquo;stick&rdquo;
to, as per the <B><A HREF="../TkCmd/grid.htm">grid</A></B> geometry manager.
<P><DT>Command-Line Name: <B><A NAME="M13">-padding</A></B>
<DT>Database Name: <B>padding</B>
<DT>Database Class: <B>Padding</B>
<DD>Specifies the amount of extra space to add between the notebook and this pane.
Syntax is the same as for the widget <B>-padding</B> option.
<P><DT>Command-Line Name: <B><A NAME="M14">-text</A></B>
<DT>Database Name: <B>text</B>
<DT>Database Class: <B>Text</B>
<DD>Specifies a string to be displayed in the tab.
<P><DT>Command-Line Name: <B><A NAME="M15">-image</A></B>
<DT>Database Name: <B>image</B>
<DT>Database Class: <B>Image</B>
<DD>Specifies an image to display in the tab.
See <I>ttk_widget(n)</I> for details.
<P><DT>Command-Line Name: <B><A NAME="M16">-compound</A></B>
<DT>Database Name: <B>compound</B>
<DT>Database Class: <B>Compound</B>
<DD>Specifies how to display the image relative to the text,
in the case both <B>-text</B> and <B>-image</B> are present.
See <I>label(n)</I> for legal values.
<P><DT>Command-Line Name: <B><A NAME="M17">-underline</A></B>
<DT>Database Name: <B>underline</B>
<DT>Database Class: <B>Underline</B>
<DD>Specifies the integer index (0-based) of a character to underline
in the text string.
The underlined character is used for mnemonic activation
if <B>ttk::notebook::enableTraversal</B> is called.
</DL>
<H3><A NAME="M18">TAB IDENTIFIERS</A></H3>
The <I>tabid</I> argument to the following commands may take
any of the following forms:
<P>
<UL class="tab identifiers">
<LI>
An integer between zero and the number of tabs;
<P><LI>
The name of a content window;
<P><LI>
A positional specification of the form
&ldquo;@<I>x</I>,<I>y</I>&rdquo;,
which identifies the tab
<P><LI>
The literal string
&ldquo;<B>current</B>&rdquo;,
which identifies the currently-selected tab; or:
<P><LI>
The literal string
&ldquo;<B>end</B>&rdquo;,
which returns the number of tabs
(only valid for
&ldquo;<I>pathname </I><B>index</B>&rdquo;).
<P></UL>
<H3><A NAME="M19">WIDGET COMMAND</A></H3>
<DL class="widget command">
<DT><A NAME="M20"><I>pathname </I><B>add </B><I>window</I> ?<I>options...</I>?</A><DD>
Adds a new tab to the notebook.
See <B><A HREF="#M10">TAB OPTIONS</A></B> for the list of available <I>options</I>.
If <I>window</I> is currently managed by the notebook but hidden,
it is restored to its previous position.
<P><DT><A NAME="M21"><I>pathname </I><B>configure</B> ?<I>options</I>?</A><DD>
See <I>ttk::widget(n)</I>.
<P><DT><A NAME="M22"><I>pathname </I><B>cget </B><I>option</I></A><DD>
See <I>ttk::widget(n)</I>.
<P><DT><A NAME="M23"><I>pathname </I><B>forget </B><I>tabid</I></A><DD>
Removes the tab specified by <I>tabid</I>,
unmaps and unmanages the associated window.
<P><DT><A NAME="M24"><I>pathname </I><B>hide </B><I>tabid</I></A><DD>
Hides the tab specified by <I>tabid</I>.
The tab will not be displayed, but the associated window
remains managed by the notebook and its configuration remembered.
Hidden tabs may be restored with the <B>add</B> command.
<P><DT><A NAME="M25"><I>pathname </I><B>identify</B><I> component x y</I></A><DD>
Returns the name of the element under the point given by <I>x</I> and <I>y</I>,
or the empty string if no component is present at that location.
The following subcommands are supported:
<P>
<DL class="widget command">
<DT><A NAME="M26"><I>pathname </I><B>identify element</B> <I>x y</I></A><DD>
Returns the name of the element at the specified location.
<P><DT><A NAME="M27"><I>pathname </I><B>identify tab</B> <I>x y</I></A><DD>
Returns the index of the tab at the specified location.
<P></DL>
<P><DT><A NAME="M28"><I>pathname </I><B>index </B><I>tabid</I></A><DD>
Returns the numeric index of the tab specified by <I>tabid</I>,
or the total number of tabs if <I>tabid</I> is the string
&ldquo;<B>end</B>&rdquo;.
<P><DT><A NAME="M29"><I>pathname </I><B>insert </B><I>pos subwindow options...</I></A><DD>
Inserts a pane at the specified position.
<I>pos</I> is either the string <B>end</B>, an integer index,
or the name of a managed subwindow.
If <I>subwindow</I> is already managed by the notebook,
moves it to the specified position.
See <B><A HREF="#M10">TAB OPTIONS</A></B> for the list of available options.
<P><DT><A NAME="M30"><I>pathname </I><B>instate </B><I>statespec </I>?<I>script...</I>?</A><DD>
See <I>ttk::widget(n)</I>.
<P><DT><A NAME="M31"><I>pathname </I><B>select</B> ?<I>tabid</I>?</A><DD>
Selects the specified tab.
The associated content window will be displayed,
and the previously-selected window (if different) is unmapped.
If <I>tabid</I> is omitted, returns the widget name of the
currently selected pane.
<P><DT><A NAME="M32"><I>pathname </I><B>state</B> ?<I>statespec</I>?</A><DD>
See <I>ttk::widget(n)</I>.
<P><DT><A NAME="M33"><I>pathname </I><B>tab </B><I>tabid</I> ?<I>-option </I>?<I>value ...</I></A><DD>
Query or modify the options of the specific tab.
If no <I>-option</I> is specified,
returns a dictionary of the tab option values.
If one <I>-option</I> is specified,
returns the value of that <I>option</I>.
Otherwise, sets the <I>-option</I>s to the corresponding <I>value</I>s.
See <B><A HREF="#M10">TAB OPTIONS</A></B> for the available options.
<P><DT><A NAME="M34"><I>pathname </I><B>tabs</B></A><DD>
Returns the list of windows managed by the notebook, in the index order of
their associated tabs.
<P></DL>
<H3><A NAME="M35">KEYBOARD TRAVERSAL</A></H3>
To enable keyboard traversal for a toplevel window
containing a notebook widget <I>$nb</I>, call:
<PRE>ttk::notebook::enableTraversal $nb</PRE>
<P>
This will extend the bindings for the toplevel window
containing the notebook as follows:
<P>
<UL class="keyboard traversal">
<LI>
<B>Control-Tab</B> selects the tab following the currently selected one.
<P><LI>
<B>Control-Shift-Tab</B> selects the tab preceding the currently selected one.
<P><LI>
<B>Alt-</B><I>K</I>, where <I>K</I> is the mnemonic (underlined) character
of any tab, will select that tab.
<P></UL>
<P>
Multiple notebooks in a single toplevel may be enabled for traversal,
including nested notebooks.
However, notebook traversal only works properly if all panes
are direct children of the notebook.
<H3><A NAME="M36">VIRTUAL EVENTS</A></H3>
The notebook widget generates a <B>&lt;&lt;NotebookTabChanged&gt;&gt;</B>
virtual event after a new tab is selected.
<H3><A NAME="M37">EXAMPLE</A></H3>
<PRE>pack [<B>ttk::notebook</B> .nb]
	.nb add [frame .nb.f1] -text &quot;First tab&quot;
	.nb add [frame .nb.f2] -text &quot;Second tab&quot;
	.nb select .nb.f2
ttk::notebook::enableTraversal .nb</PRE>
<H3><A NAME="M38">STYLING OPTIONS</A></H3>
The class name for a <B>ttk::notebook</B> is <B>TNotebook</B>.  The tab has
a class name of <B>TNotebook.Tab</B>
<P>
Dynamic states: <B>active</B>, <B>disabled</B>, <B>selected</B>.
<P>
<B>TNotebook</B> styling options configurable with <B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B>
are:
<P>
<B>-background</B> <I>color</I>
<BR>
<B>-bordercolor</B> <I>color</I>
<BR>
<B>-darkcolor</B> <I>color</I>
<BR>
<B>-foreground</B> <I>color</I>
<BR>
<B>-lightcolor</B> <I>color</I>
<BR>
<B>-padding</B> <I>padding</I>
<BR>
<B>-tabmargins</B> <I>padding</I>
<BR>
<B>-tabposition</B> <I>side</I>
<BR>
<P>
<B>TNotebook.Tab</B> styling options configurable with <B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B>
are:
<P>
<B>-background</B> <I>color</I>
<BR>
<B>-bordercolor</B> <I>color</I>
<BR>
<B>-compound</B> <I>compound</I>
<BR>
<B>-expand</B> <I>padding</I>
<DL><DD>
Defines how much the tab grows in size.  Usually used with the
<B>selected</B> dynamic state.  <B>-tabmargins</B> should be
set appropriately so that there is room for the tab growth.
</DL>
<B>-font</B> <I>font</I>
<BR>
<B>-foreground</B> <I>color</I>
<BR>
<B>-padding</B> <I>padding</I>
<P>
Some options are only available for specific themes.
<P>
See the <B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B> manual page for information on how to configure
ttk styles.
<H3><A NAME="M39">SEE ALSO</A></H3>
<B><A HREF="../TkCmd/ttk_widget.htm">ttk::widget</A></B>, <B><A HREF="../TkCmd/grid.htm">grid</A></B>
<H3><A NAME="M40">KEYWORDS</A></H3>
<A href="../Keywords/P.htm#pane">pane</A>, <A href="../Keywords/T.htm#tab">tab</A>
<div class="copy">Copyright &copy; 2004 Joe English
</div>
</BODY></HTML>
